$(document).ready(function() {

    	$("#ajoutQuestionQCM").submit(function() {
		if($("#question").val() && $("#reponse1").val() && $("#reponse2").val() && $("#reponse3").val() && $("#reponse-details").val()) {              
                var question = $("#question").val();
                var reponse1 = $("#reponse1").val();
                var reponse2 = $("#reponse2").val();
                var reponse3 = $("#reponse3").val();
		var reponse_details = $("#reponse-details").val();
                var qcmRubrique = $("#qcmRubrique").val();
                var est_reponse = $('input:radio:checked').val();               
              
		$.ajax({
			type : 'POST',
			url : 'ajax/qcmActions.ajax.php',
			data : 'question=' + question+'&reponse1=' + reponse1+
                               '&reponse2='+reponse2+
                               '&reponse3='+reponse3+
                               '&reponse-details='+reponse_details+
                               '&qcmRubrique='+qcmRubrique+
                               '&est-reponse='+est_reponse,
			success : function(data) { 
                                var url='index.php?rub=qcm-add';                              
				$(location).attr('href',url);
			}
		});
		} else {
			alert('Faut que tu remplisses tous les champs obligatoires...');
		}
			
		return false;

	});
     
      
});
